#include<time.h>
#include<stdlib.h>
#include<stdio.h>
#include<fcntl.h>
#include<sys/time.h>
#include<stdint.h>
uint64_t  get_current_time(void)
{
    struct timeval t;
    if (gettimeofday(&t, NULL)) {
                printf("Get current time error!");
                return -1;
        }
    return (uint64_t) t.tv_sec * 1000 + t.tv_usec / 1000;
}

int  build_segfile_name(uint32_t segno, const char *seg_name)
{
   if(seg_name==NULL)
   {
      printf("seg name is null");
      return  -1;
   }
   else
   {
      snprintf((char *) segfile_name,SEGMENT_FILE_NAME_MAX,"%u%s%s",segno,".","seg");
      return 0;
   }
}

int  build_segfile_name_by_address(uint64_t storage_address, const char*segfile_name)
{
    //HLOG_DEBUG("enter func %s", __func__);
    if(segfile_name==NULL){
        return -1;
    }
    uint32_t segno  = get_segno(storage_address);
    snprintf((char *) segfile_name,SEGMENT_FILE_NAME_MAX,"%u%s%s",segno,".","seg");
    //HLOG_DEBUG("leave func %s", __func__);
    return 0;
}

uint32_t  get_seg_no(const char  * segfile)
{
      uint32_t  seg_no;
          


}

